REST (Representational State Transfer) describes a network system in an architectural style, for example, a web application program. In a RESTful architecture, each entity or each piece of information is a resource, and may be a piece of text, a picture, a song, a service, or the like. Each resource corresponds to a specific URL (Uniform Resource Locator), and the resource is obtained by accessing a URI of the resource. A RESTful system usually uses a client/server mode, and nodes transmit data to each other in a hop-by-hop addressing manner based on a URL of a resource.
Currently, some Internet of Things systems use the RESTful architecture. A device is connected to a cloud platform directly or through a gateway, and data generated by the device is reported to the platform in a form of resource. However, on the industrial Internet of Things, each device publishes tens of thousands of pieces of data per second, and the data is reported to the cloud platform through the gateway, overloading the cloud platform and the gateway, and resulting in congestion and a packet loss. In some strict scenarios, for example, applications scenarios such as medical treatment and intelligent vehicles, there is a relatively high requirement on data for real-time quality, and delayed transmission of data may result in disastrous consequences. For example, a connection is established between an automobile self-driving system, a vehicle speed sensor, a road monitoring system, a console, a braking system, and the like. When the road monitoring system detects that a road condition is abnormal, the road condition information needs to be reported to the console in time, and the console sends a control command to the braking system based on a vehicle speed and the road condition information, for braking.
Referring to FIG. 1, FIG. 1 is an architectural diagram of an Internet of Things cloud platform 1 that is based on a RESTful architecture. The Internet of Things cloud platform 1 includes an apparatus 11, a gateway 12, a cloud platform 13, a gateway 14, and an apparatus 15. Because a client (that is, the apparatus 11)/server (that is, the apparatus 15) mode is used in communication, devices communicate with each other in a hop-by-hop addressing manner based on a URL of a resource, cross-gateway transmission requires a cloud platform to forward a message, and apparatuses cannot perform direct P2P communication with each other. For example, the apparatus 11 registers with the gateway 12, the apparatus 15 registers with the gateway 14, and the gateway 12 and the gateway 14 register with the cloud platform. When the apparatus 11 needs to send a message to the apparatus 15, the apparatus 11 first sends the message to the gateway 12. The gateway 12 obtains URL information of the apparatus 15 from the message, and forwards the message to the cloud platform if a URL of the apparatus 15 cannot be found in local registration information. The cloud platform parses the URL of the apparatus 15 in the message, and forwards the message to the gateway 14 when discovering, in local registration information, that the gateway 14 has the URL resource, and the gateway 14 forwards the message to the apparatus 15. However, a disadvantage of the Internet of Things cloud platform 1 that is based on the RESTful architecture is that the apparatus 11 and the apparatus 15 cannot perform direct P2P communication with each other, increasing a message transmission delay.
Therefore, how to provide a resource subscription system having high transmission efficiency is still a problem that needs to be addressed in the field.